<?php
    class Goods {

        // 获取商品信息
        function Goods_09091($id, $conn)
        {
            $result = $conn->query("SELECT * FROM `goods` WHERE `id` = $id ");
            if ($result->rowCount() == 1) {
                // $arr = $result->FetchAll();
                foreach($result->FetchAll() as $result) {
                    $arr = array(
                        'id' => $result['id'],
                        'img' => json_decode($result['img']),
                        'name' => $result['name'],
                        'text' => $result['text'],
                        'spec' => json_decode($result['spec']),
                        'price' => $result['price'],
                        'type' => $result['type']
                    );
                }

                    // $img => $result['img'],
                    // 'name' => $result['name'],
            }

            return $arr;
        }
        
    }

